﻿using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.SessionState;
using OrchardFork.Framework.Mvc.Routes;

namespace OrchardForkTest
{
    public class Route : IRouteProvider
    {

        public void GetRoutes(ICollection<RouteDescriptor> routes)
        {
            foreach (var routeDescriptor in GetRoutes())
            {
                routes.Add(routeDescriptor);
            }
        }

        public IEnumerable<RouteDescriptor> GetRoutes()
        {
            return new[]
            {
                
                new RouteDescriptor
                {
                    Route = new System.Web.Routing.Route(
                        "{controller}/{action}.html",
                        new RouteValueDictionary(),
                        new RouteValueDictionary
                        {
                            {"area", "OrchardForkTest"}
                        },
                        new MvcRouteHandler()),
                        Priority = 100,
                        Name = "WebHome",
                        SessionState = SessionStateBehavior.Default
                },
                new RouteDescriptor {
                    Route = new System.Web.Routing.Route(
                        "",
                        new RouteValueDictionary {
                            {"area", "OrchardForkTest"},
                            {"controller", "home"},
                            {"action", "index"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "OrchardForkTest"}                            
                        },
                        new MvcRouteHandler())
                }
            };
        }

    }
}